package top.continew.ai.util.parse;

import org.springframework.ai.document.Document;
import org.springframework.ai.reader.tika.TikaDocumentReader;
import org.springframework.core.io.FileSystemResource;

import java.util.List;

/**
 * ApachTikaParse:
 *
 * @Author： Lonni
 * @Date： 2025/8/21  15:55
 */
public class ApachTikaParse implements BaseParse {
    /**
     * 解析并切分文件
     *
     * @param filePath
     * @param fileName
     * @return
     */
    @Override
    public List<Document> renderDocment(String filePath, String fileName) {
        FileSystemResource resource = new FileSystemResource(filePath);
        TikaDocumentReader tikaDocumentReader = new TikaDocumentReader(resource);

        List<Document> documents = tikaDocumentReader.read();
        return documents;

    }
}
